home *** CD-ROM | disk | FTP | other *** search
GW-BASIC | 1984-04-24 | 2.9 KB | 71 lines |
- 10 REM WSINDEX.BAS
- 20 '
- 30 ' WORDSTAR INDEXING PROGRAM. 5/28/83 Version 1.0
- 40 ' Purpose: Display (while in Wordstar) a list of text files with a short
- 50 ' description of their contents.
- 60 '
- 70 ' Operating Instructions:
- 80 ' I. Adding a description to Wordstar Files
- 90 ' The very first line in each of your Wordstar text files should
- 100 ' be a comment line (begins with two periods). This line is
- 110 ' displayed as a description of your file. The following format
- 120 ' is recommended but not required: ".. mm/dd/yy xxxxxxxxxxx"
- 130 ' The two periods cause Wordstar to ignore the line. When displayed
- 140 ' this program will show the creation date and a short description.
- 150 ' This program assumes that your Wordstar files have
- 160 ' a file type of "TXT" or " " (blank extension).
- 170 '
- 180 ' II. Obtaining File Descriptions under Wordstar
- 190 ' A. Make sure your default disk (either A: or B: as is your custom)
- 200 ' has this program as well as BASICA.COM
- 210 ' B. From the initial Wordstar Menu, select the "R"un command
- 220 ' C. Type "BASICA WSINDEX" as the program to run
- 230 ' Follow the displayed instructions.
- 240 '
- 250 '
- 260 DIM D$(120) 'list of file names (120 is max # possible)
- 265 CLS:PRINT
- 270 FILES :PRINT:PRINT 'easiest way to get names into BASIC
- 280 PRINT "Wait a minute while I read all of these file names"
- 290 I=2: J=1: N=0: A$="" 'put Wordstar names into D$ array
- 300 WHILE SCREEN(I,J)<>0 AND J<78 AND SCREEN(I,J)<>32
- 310 A$=""
- 320 FOR K=0 TO 11
- 330 A$=A$+CHR$(SCREEN(I,J+K))
- 340 NEXT K
- 350 IF RIGHT$(A$,3)<>" " AND RIGHT$(A$,3)<>"TXT" THEN 370
- 360 N=N+1: D$(N)=A$
- 370 J=J+13
- 380 IF J>70 THEN J=1: I=I+1
- 390 WEND
- 400 PRINT "OK, now I must sort these into alphabetical order"
- 410 C=0 :S=0
- 420 ' START OF SHELL METZNER SORT
- 430 M=N
- 440 M=INT(M/2) :IF M=0 THEN 550
- 450 J=1 :K=N-M
- 460 I=J
- 470 L=I+M :C=C+1
- 480 IF D$(I) <=D$(L) THEN 520
- 490 SWAP D$(I),D$(L)
- 500 I=I-M
- 510 IF I>0 THEN 470
- 520 J=J+1
- 530 IF J>K THEN 440
- 540 GOTO 460
- 550 '
- 560 INDEX=1
- 570 CLS
- 580 FOR LCOUNT = 1 TO 20 'display 20 file names per screen
- 590 IF LCOUNT=1 THEN CLS:PRINT "File","Description":PRINT"========","=============================="
- 600 OPEN D$(INDEX) FOR INPUT AS #1 'open the Wordstar text file
- 610 LINE INPUT #1,A$ 'read the description line
- 620 IF LEFT$(A$,2)<>".." THEN A$="No Name present in file" ELSE A$=RIGHT$(A$,LEN(A$)-INSTR(A$," ")) 'supply a default description if none
- 630 PRINT D$(INDEX),A$
- 640 CLOSE #1
- 650 INDEX = INDEX + 1 'point to next file
- 660 IF INDEX>N THEN GOTO 690 'exit loop when done
- 670 NEXT LCOUNT
- 680 PRINT "PRESS [Esc] TO STOP, ANY OTHER KEY TO CONTINUE";:IF ASC(INPUT$(1))<>27 THEN GOTO 570
- 690 SYSTEM ' return to Wordstar
-